my file learn about tech container (docker, podman, kubernetes)
apiVersion: v1
kind: Pod
metadata:
name: pod-name
labels:
label-key1: label-value1
annotations:
annotation-key1: annotation-value
annotation-key2: veri long annotation value, bla bla bla bla bla bla
spec:
containers:
- name: container-name
image: image-name
ports:
- containerPort: 80
# probe
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
startupProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
apiVersion: v1
kind: Pod
metadata:
name: nginx-with-probe
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
# probe
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 4
kubectl describe pod
Liveness: http-get http://:80/ delay=0s timeout=1s period=10s #success=1 #failure=4
# setelah pengecekan 5 kali dan error trus maka akan crashLoopBackOff
WSL at bash ~/kube_aria/dasar ❯ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-with-probe 1/1 Running 0 8m26s
nginx-with-probe-err 0/1 CrashLoopBackOff 4 (5s ago) 3m30s